function pow(a:double; b:int64):double;

var 
	t:int64;
	pw:double;

begin
if b<0 then t:=-1 else t:=1;
b:=abs(b);
if b=0 then result:=1 else begin
	pw:=a;
	result:=1;
	while b>0 do begin
		if b mod 2=1 then result:=result*pw;
		pw:=pw*pw;
		b:=b div 2;
	end;
end;
if t=-1 then result:=1/result;
end;

function pow(i:double; k:longint):double;

const
	eps:double=1e-6;

var
	t:double;

begin
if abs(i)<eps then t:=0 else t:=exp(abs(k)*ln(abs(i)));
if (i<0) and odd(k) then t:=-t;
if (k<0) and (abs(i)>eps) then t:=1/t;
result:=t;	
end;